<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>解构赋值</title>
</head>
<body>
<p>解构：把整体查分成组件，机器人的对象=》解构=》头+身体+肚子+四肢</p>
<script>
    // 传统的赋值
    var a = 1, b = 2, c= 3;
    console.log(a,b,c);

    // 数组的解构赋值
    var [x,y,z]=[1,2,3]
    console.log(x,y,z);

    // 对象的赋值
    var user={name:"李四",age:12,address:"郑州"}
    var username = user.name;
    var userage = user.age;
    var useraddr = user.address;
    console.log(username,userage,useraddr);

    // ES6 的对象解构赋值
    var {name,age,address}=user;
    var {address}=user;
    console.log(name,age,address)
</script>

</body>
</html>